function centroids_subpixel = detect_beads_LF_2(LF, Minthreshold)

    if (~exist('Minthreshold','var'))
        Minthreshold=0.1;
    end


    LF = double(LF);
    %figure,sliceViewer(LF);
    %figure,sliceViewer(imadjustn(LF));
    
    BW = zeros(size(LF));
    BW(100:end-200, 200:end-100, 19:end-19) = 1;  %指定一个感兴趣的体积范围，排除边界区域的可能噪声
    BW(LF<(mean(LF(:)+50))) = 0;  %进一步排除背景噪声和低强度区域，只保留可能感兴趣的区域
    BW(:,:,45:55)=0;
    LF = BW .* LF;
    %figure,sliceViewer(LF);
    %figure,sliceViewer(imadjustn(LF));




    % 预处理：高斯滤波平滑体数据，去噪
    volFiltered = imgaussfilt3(LF, 2); % 3D高斯滤波
    
    % 预处理，扣除底部10%灰度, 光场图像需要扣除伪影等信号
    volFiltered=single(volFiltered);
    volFiltered=volFiltered-Minthreshold*max(volFiltered(:)); %将10%的灰度作为背景扣除
    volFiltered(volFiltered<0)=0;

    % 二值化处理
    threshold = graythresh(volFiltered(:)); % 自动阈值
    bwVol = imbinarize(volFiltered, threshold);
    
    % 去除小噪声（3D连通区域分析）
    bwVol = bwareaopen(bwVol, 20); % 删除小于50体素的连通区域
    
    % 提取3D中心坐标
    stats = regionprops3(bwVol, 'Centroid'); 
    
    centroids_subpixel = table2array(stats);
end